#ifndef __JSON_CFG_H__
#define __JSON_CFG_H__
#include <stdint.h>

#define IMAGE_ALIGN(x, mask) ( ((x) + (mask) - 1) & ~((mask) - 1) )
#define __CONFIG_FILE_PATH__		"/jffs0/hi_config.json"

struct config_param
{
	int vi_width;
	int vi_height;
	char vi_pix_fmt[32];
	int vi_fps;
	int vi_crop_x;
	int vi_crop_y;
	int vi_crop_width;
	int vi_crop_height;

	int encoder_width;
	int encoder_height;
	char encoder_type[32];
	int encoder_gop;
	int encoder_fps;
	int encoder_bps;

	int vo_width;
	int vo_height;
	int vo_fps;
	char vo_pix_fmt[32];

	int rtsp_port;
	char ip[32];
};

int read_json_config(char* path, struct config_param* params);
int write_json_config(char* path, struct config_param* params);


struct ucontrol_param
{
	int defog_flag;
	int defog_value;
	int contrast_value;
	int brightness_value;
	int zoom_value;
	int enhance_flag;
	int enhance_value;
	int gain_flag;
	int gain_value;

	int osd_flag;
	int crossline_flag;
	int crossline_x;
	int crossline_y;
};
void read_ucontrol_param(struct ucontrol_param* param);
void write_ucontrol_param(struct ucontrol_param* param);
void clear_ucontrol_param();

#endif
